package com.swak.boot.config.vertx;

import static com.swak.boot.Application.APP_LOGGER;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.swak.vertx.transport.VertxProxy;
import com.swak.vertx.transport.server.ReactiveServer;

/**
 * vertx 服务器配置
 * 
 * @author lifeng
 */
@Configuration
@ConditionalOnClass(ReactiveServer.class)
public class ReactiveServerAutoConfiguration {

	public ReactiveServerAutoConfiguration() {
		APP_LOGGER.debug("Loading Reactive Server");
	}

	/**
	 * 加载服务配置处理器
	 * 
	 * @return
	 */
	@Bean
	public ServiceAnnotationBeanPostProcessor fluxServiceAnnotationBeanPostProcessor() {
		return new ServiceAnnotationBeanPostProcessor();
	}

	/**
	 * 加载依赖配置处理器
	 * 
	 * @return
	 */
	@Bean
	public ReferenceAnnotationBeanPostProcessor fluxReferenceAnnotationBeanPostProcessor() {
		return new ReferenceAnnotationBeanPostProcessor();
	}

	/**
	 * 响应式服务器
	 * 
	 * @return
	 */
	@Bean
	public ReactiveServer ReactiveServer(VertxProxy vertx) {
		return new ReactiveServer(vertx);
	}
}